home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / content / nsIForm.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  7KB  |  190 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37. #ifndef nsIForm_h___
  38. #define nsIForm_h___
  39.  
  40. #include "nsISupports.h"
  41. #include "nsAString.h"
  42.  
  43. class nsIFormControl;
  44. class nsIDOMHTMLInputElement;
  45. class nsIRadioVisitor;
  46. class nsISimpleEnumerator;
  47. class nsIURI;
  48.  
  49. #define NS_FORM_METHOD_GET  0
  50. #define NS_FORM_METHOD_POST 1
  51. #define NS_FORM_ENCTYPE_URLENCODED 0
  52. #define NS_FORM_ENCTYPE_MULTIPART  1
  53. #define NS_FORM_ENCTYPE_TEXTPLAIN  2
  54.  
  55.  
  56. // IID for the nsIFormManager interface
  57. #define NS_IFORM_IID    \
  58. { 0xb7e94510, 0x4c19, 0x11d2,  \
  59.   { 0x80, 0x3f, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
  60.  
  61.  
  62. /**
  63.  * This interface provides a complete set of methods dealing with
  64.  * elements which belong to a form element. When nsIDOMHTMLCollection
  65.  * allows write operations
  66.  */
  67.  
  68. class nsIForm : public nsISupports
  69. {
  70. public:
  71.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFORM_IID)
  72.  
  73.   /**
  74.    * Add an element to end of this form's list of elements
  75.    *
  76.    * @param aElement the element to add
  77.    * @return NS_OK if the element was successfully added
  78.    */
  79.   NS_IMETHOD AddElement(nsIFormControl* aElement) = 0;
  80.  
  81.   /**    
  82.    * Add an element to the lookup table mainted by the form.
  83.    *
  84.    * We can't fold this method into AddElement() because when
  85.    * AddElement() is called, the form control has no
  86.    * attributes.  The name or id attributes of the form control
  87.    * are used as a key into the table.
  88.    */
  89.   NS_IMETHOD AddElementToTable(nsIFormControl* aElement,
  90.                                const nsAString& aName) = 0;
  91.  
  92.   /**
  93.    * Get the element at a specified index position in form.elements
  94.    *
  95.    * @param aIndex the index
  96.    * @param aElement the element at that index
  97.    * @return NS_OK if there was an element at that position, -1 otherwise
  98.    */
  99.   NS_IMETHOD GetElementAt(PRInt32 aIndex, nsIFormControl** aElement) const = 0;
  100.  
  101.   /**
  102.    * Get the number of elements in form.elements
  103.    *
  104.    * @param aCount the number of elements
  105.    * @return NS_OK if there was an element at that position, -1 otherwise
  106.    */
  107.   NS_IMETHOD GetElementCount(PRUint32* aCount) const = 0;
  108.  
  109.   /**
  110.    * Remove an element from this form's list of elements
  111.    *
  112.    * @param aElement the element to remove
  113.    * @return NS_OK if the element was successfully removed.
  114.    */
  115.   NS_IMETHOD RemoveElement(nsIFormControl* aElement) = 0;
  116.  
  117.   /**
  118.    * Remove an element from the lookup table mainted by the form.
  119.    * We can't fold this method into RemoveElement() because when
  120.    * RemoveElement() is called it doesn't know if the element is
  121.    * removed because the id attribute has changed, or bacause the
  122.    * name attribute has changed.
  123.    *
  124.    * @param aElement the element to remove
  125.    * @param aName the name or id of the element to remove
  126.    * @return NS_OK if the element was successfully removed.
  127.    */
  128.   NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement,
  129.                                     const nsAString& aName) = 0;
  130.  
  131.   /**
  132.    * Resolve a name in the scope of the form object, this means find
  133.    * form controls in this form with the correct value in the name
  134.    * attribute.
  135.    *
  136.    * @param aElement the element to remove
  137.    * @param aName the name or id of the element to remove
  138.    * @return NS_OK if the element was successfully removed.
  139.    */
  140.   NS_IMETHOD ResolveName(const nsAString& aName,
  141.                          nsISupports **aResult) = 0;
  142.  
  143.   /**
  144.    * Get the index of the given control within form.elements.
  145.    * @param aControl the control to find the index of
  146.    * @param aIndex the index [OUT]
  147.    */
  148.   NS_IMETHOD IndexOfControl(nsIFormControl* aControl, PRInt32* aIndex) = 0;
  149.  
  150.   /**
  151.    * Get an enumeration that goes through all controls, including images and
  152.    * that ilk
  153.    * @param aEnum the enumeration [OUT]
  154.    */
  155.   NS_IMETHOD GetControlEnumerator(nsISimpleEnumerator** aEnum) = 0;
  156.  
  157.   /**
  158.    * Flag the form to know that a button or image triggered scripted form
  159.    * submission. In that case the form will defer the submission until the
  160.    * script handler returns and the return value is known.
  161.    */ 
  162.   NS_IMETHOD OnSubmitClickBegin() = 0;
  163.   NS_IMETHOD OnSubmitClickEnd() = 0;
  164.  
  165.   /**
  166.    * Flush a possible pending submission. If there was a scripted submission
  167.    * triggered by a button or image, the submission was defered. This method
  168.    * forces the pending submission to be submitted. (happens when the handler
  169.    * returns false or there is an action/target change in the script)
  170.    */
  171.   NS_IMETHOD FlushPendingSubmission() = 0;
  172.   /**
  173.    * Forget a possible pending submission. Same as above but this time we
  174.    * get rid of the pending submission cause the handler returned true
  175.    * so we will rebuild the submission with the name/value of the triggering
  176.    * element
  177.    */
  178.   NS_IMETHOD ForgetPendingSubmission() = 0;
  179.  
  180.   /**
  181.    * Get the full URL to submit to.  Do not submit if the returned URL is null.
  182.    *
  183.    * @param aActionURL the full, unadulterated URL you'll be submitting to [OUT]
  184.    */
  185.   NS_IMETHOD GetActionURL(nsIURI** aActionURL) = 0;
  186.  
  187. };
  188.  
  189. #endif /* nsIForm_h___ */
  190.